<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xftl">
<head>
<meta http-equiv="Content-Type" content="text/ftl; charset=UTF-8"/>
	<title>微信标签管理</title>
	<#include '/frame/version.html'>
	<#include '/frame/manage/include_css.html'>
	<#include '/frame/manage/include_js.html'>
	<#include '/frame/taglib.html'>
</head>
<body id="nv_member" class="pg_CURMODULE">
	<#assign current='menu_tags'>
	<div id="wp" class="wp">
		<#include "/include/header.html"/>
		<div class="contentmanage">
			<div class="developer">
				<div class="tableContent">
					<#include "/include/left.html"/>
					<#include "/include/wxtop.html"/>
 <div class="content">
    <div class="cLineB">
        <h4 class="left">
        	标签客户管理
        </h4>
        <div class="clr">
        </div>
    </div>
    <div class="cLine">
	       
        <div class="pageNavigator right">
            <form action="${base}/admin/tags/list" method="get" id="form_pagination">
			 	名称：<input class="px" name="name" placeholder="请输入名称" value="${name}" maxlength="30"/>
				<input type="submit" value="搜索" class='btnGreen'/>
            </form>
        </div>
        <div class="clr">
        </div>
    </div>
    <div class="msgWrap">
            <table width="100%" cellspacing="0" cellpadding="0" border="0" class="ListProduct Shallow_border_color">
                <thead>
                    <tr>
						<th style="width:50px;">编号</th>
						<th>客户名称</th>
						<th>手机号</th>
						<th>身份证号</th>
					
                    </tr>
                </thead>
                <tbody>
                <#if page?exists>
                <#list page.recordList as bean >
                    <tr>
                       <td valign="middle" align="center">${page.pernum*(page.currentPage-1)+bean_index+1}</td>
                        <td>${bean.custName}</td><!--_${bean.tagStatus}-->
                        <td>${bean.custPhone}</td><!--_${bean.tagStatus}-->
                        <td>${bean.custIdNum}</td><!--_${bean.tagStatus}-->
                    </tr>
                    </#list>
                    </#if>
                </tbody>
            </table>
    </div>
     <#if page?exists>
       <#include "/include/form_pagination.html"/>
        <#include "/include/simple_page_js.html"/>         
     </#if>
   
  </div>
 <div class="clr"></div>
 </div>
 </div>
 </div>
</div>
<#include "/include/footer.html"/>
<script type="text/javascript" src="${base}/js/My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">

function conversion(type, id, obj) {
	$.ajax({type:'POST',
        url:'${basePath}/manage/tags/conversion/' + type + '/' + id,
	   success:function(data){
		   if (data == 'name') {
			   stem.info('标签名重复');
		   } else if (data == 'out') {
			   stem.info('创建不能超过100个');
		   } else if (data == 'error') {
			   stem.info('异常');
		   }else if (data == 'success') {
			   var inputs = $(obj).parent().parent().find('td');
			   if (type == 'wechat') {
				   $(inputs[2]).html('微信');
				   obj.innerHTML='转换至本地';
				   $(obj).attr("onclick", "conversion('local', " + id + ",  this)");  
				} else {
					$(inputs[2]).html('本地');
					obj.innerHTML='转换至微信';
					
					$(obj).attr("onclick","conversion('wechat', " + id + ",  this)");
				}
			   
				stem.info("操作成功");
			}
		}    
    	
	});
	
}

function exportExcel(that){
    var $form = $(that).closest("form");
    $form.submit();
}
function deltag(id, tagStatus){
	stem.confirm("确定要删除该标签吗？","确认信息",function(){
		window.location='${basePath}/manage/tags/delt?id='+id + '&tagStatus=' + tagStatus;
	});
};
function addtag(){
	stem.confirm("<select name='lable' id='lable' style='width: 150px; '><option value='1'>微信标签</option><option value='2'>本地标签</option></select> " +
            "<br>标签名称：<input id='tagname' name='name' placeholder='请输入名称'  maxlength='30' class='px'/>","添加标签",function(){
		if($("#tagname").val()==""){
		stem.info("请填写标签名称");
		return false;
		}
		jQuery.ajax({type:'POST',
	              url:'${basePath}/admin/tags/addt',
				  data:{"name":$("#tagname").val(), "lable" : $("#lable").val()},
				
			   success:function(data){
			   		if(data=="success"){
				   		window.location='${basePath}/manage/tags/list';
			   		}else if(data=="name"){
			   			stem.info("标签名重复");
			   		}else if(data=="out"){
			   			stem.info("创建的标签数过多，请注意不能超过100个");
			   		}else{
			   			stem.info("创建失败");
			   		}
				  }    
	          	
	    });
	});
}
function updatetag(id, name){
	stem.confirm("标签名称：<input id='tagname' name='name' placeholder='请输入名称' value='"+name+"' maxlength='30'/>","修改标签",function(){
		if($("#tagname").val()==""){
		stem.info("请填写标签名称");
		return false;
		}
		jQuery.ajax({type:'POST',
	              url:'${basePath}/manage/tags/edit',
				  data:{"name":$("#tagname").val(),"id":id},
				
			   success:function(data){
			   		if(data=="success"){
				   		window.location='${basePath}/manage/tags/list';
			   		}else if(data=="name"){
			   			stem.info("标签名重复");
			   		}else{
			   			stem.info("修改失败");
			   		}
				  }    
	          	
	    });
	});
}
function chooseFans(tagid){
	stem.iframe('选择粉丝',base+"/manage/tags/fans?t="+tagid,['500px', '60%']);
}
function closeWindow(){
	stem.closeAll();
}
</script>
</body>
</html>